<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>gap</title>
    <style>
        h3 {
            text-align: center;
        }

        .box {
            background-color: pink;
            margin: 30px;
            padding: 20px;
        }

        .box1 {
            display: flex;
            gap: 20px;
            /* 设置行与列之间的间距 */
        }

        .box2 {
            display: grid;
            gap: 20px 30px;
            /* 行间距为20px，列间距为30px */
            grid-template-columns: repeat(4, 1fr);
            /* 四列均分 */
        }

        .item {
            padding: 20px;
            background-color: skyblue;
        }

        .item1 {
            flex: 1;
            /* 子元素均分容器宽度 */
        }
    </style>
</head>

<body>
    <h3>gap 属性在 CSS 中用于设置网格布局（Grid）或弹性布局（Flex）中项目之间的间距。</h3>
    <div class="box box1">
        <div class="item item1">item1</div>
        <div class="item item1">item1</div>
        <div class="item item1">item1</div>
        <div class="item item1">item1</div>
        <div class="item item1">item1</div>
        <div class="item item1">item1</div>
    </div>
    <div class="box box2">
        <div class="item">item1</div>
        <div class="item">item1</div>
        <div class="item">item1</div>
        <div class="item">item1</div>
        <div class="item">item1</div>
        <div class="item">item1</div>
    </div>
</body>

</html>